package com.itheima.stargraph.config;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Ollama配置类
 *
 * @Author mr.zhang
 * Date 2025/6/11 10:09
 */
@Configuration
public class OllamaConfig {
    @Value("${ollama.apiUrl}")
    private String ollamaUrl;

    /**
     * 生成OpenAI聊天客户端实例
     */
    @Bean
    public OpenAIClient openAIClient(){
        OpenAIClient client = OpenAIOkHttpClient.builder()
                .apiKey("111")
                .baseUrl(ollamaUrl)
                .build();
        return client;
    }

}
